//
//  PostWinTableViewController.m
//  CarTown
//
//  Created by xionghao on 15/8/29.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "PostWinTableViewController.h"
#import "NoramlTableViewCell.h"
#import "PickerTableViewCell.h"
#import "selectView.h"
#import "PikerImageTableViewCell.h"
#import "CarpubMode.h"
#import "Pubmode.h"
#import "IWUploadParam.h"
#import "EidtTableViewCell.h"
#import "PublishTopTableViewCell.h"
#import "RadioTableViewCell.h"
#import "AltuoPriceTableViewCell.h"
#import "NoramlCellMode.h"
#import "BaojiaTitleTableViewCell.h"
#import "XQModel.h"
#import "ZTBSMViewController.h"
#import "CarsrouceTypePickerController.h"
#import "CarSourceType.h"
#import "CarDetail.h"
#import "CarprogChildmode.h"
#import "CarbrandModel.h"
#import "CarPickModel.h"
#import "FindCarTableViewController.h"
#import "ColorPickViewController.h"
#import "CityPickerView.h"
#import "JianjieViewController.h"
#import "CarDetailTableViewCell.h"
#import "Puser.h"
@interface PostWinTableViewController ()<ColorPikerDelegate,CityPickerDelegate>
@property (nonatomic,strong) NSMutableArray *array;
@property (nonatomic,strong) NSMutableArray *setetionarray;
@property (nonatomic,strong) Pubmode *leixing;
@property (nonatomic,strong) CarPickModel *chexing;
@property (nonatomic,strong) Pubmode *waiguan;
@property (nonatomic,strong) Pubmode *neishi;
@property (nonatomic,strong) Pubmode *shangpai;
@property (nonatomic,strong) Pubmode *beizhu;
@property (nonatomic,strong) Pubmode *jiaohuo;
@property (nonatomic,strong) Pubmode *riqi;
@property (nonatomic,strong) Pubmode *fangshi;
@property (nonatomic,strong) Pubmode *yixiang;
@property (nonatomic,strong) Pubmode *kuling;
@property (nonatomic,strong) Pubmode *paifang;
@property (nonatomic,strong) Puser *user;
@end

@implementation PostWinTableViewController

+(instancetype)ViewController{
    PostWinTableViewController *post=[[PostWinTableViewController alloc]initWithStyle:UITableViewStyleGrouped];
    post.hidesBottomBarWhenPushed=YES;
    return post;
}
-(Puser *)user{
    if (_user==nil) {
        _user=[Puser getUser];
    }
    return _user;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"发招标";
    self.tableView.backgroundColor=bgGarycolor;
    
    [self setupdata];
    [self setuppostbtn];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getcarname:) name:NoticePostGetCar object:nil];
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

-(void)pushtoViewController:(UIViewController *)vc{
    [self.navigationController pushViewController:vc animated:YES];
}
#pragma -mark 车型选择回调
-(void)getcarname:(NSNotification *)notice{
    CarDetail *detail=notice.userInfo[@"cardetail"];
    CarbrandModel *brand=notice.userInfo[@"brand"];
    CarprogChildmode *carprogchild=notice.userInfo[@"cartory"];
    
    self.chexing.detail=detail.name;
    self.chexing.cardetail=detail;
    self.chexing.carporgchild=carprogchild;
    self.chexing.brand=brand;
    
    NSIndexPath *indexpath=[NSIndexPath indexPathForRow:1 inSection:0];
    NSIndexPath *indexpath1=[NSIndexPath indexPathForRow:2 inSection:0];
    NSIndexPath *indexpath2=[NSIndexPath indexPathForRow:3 inSection:0];
    [self.tableView reloadRowsAtIndexPaths:@[indexpath,indexpath1,indexpath2] withRowAnimation:UITableViewRowAnimationAutomatic];
    
}
#pragma -mark 颜色选择回调
-(void)ColorPikcerClickContoller:(ColorPickViewController *)picker withIndex:(NSInteger)index ColorStr:(NSString *)colorstr{
    NSIndexPath *indexpath;
    if(picker.view.tag==0){
        self.waiguan.detail=colorstr;
        self.waiguan.index=index;
        indexpath=[NSIndexPath indexPathForRow:2 inSection:0];
        
    }else{
        self.neishi.detail=colorstr;
        self.neishi.index=index;
        indexpath=[NSIndexPath indexPathForRow:3 inSection:0];
    }
    [self.tableView reloadRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
-(void)clearother{
    self.chexing.cardetail=nil;
    self.chexing.brand=nil;
    self.chexing.carporgchild=nil;
    self.chexing.detail=@"请选择";
    
    self.neishi.detail=@"请选择";
    self.waiguan.detail=@"请选择";
    
}
#pragma -mark 上牌地点选择回调
-(void)citypicker:(NSString *)city withPicker:(CityPickerView *)picker{
    
    switch (picker.tag) {
        case 0:
        {
            self.shangpai.detail=city;
            NSIndexPath *indexpath=[NSIndexPath indexPathForRow:6 inSection:0];
            [self.tableView reloadRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationAutomatic];
        }
            break;
        case 1:
        {
            self.jiaohuo.detail=city;
            NSIndexPath *indexpath=[NSIndexPath indexPathForRow:7 inSection:0];
            [self.tableView reloadRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationAutomatic];
        }
            break;
        default:
            break;
    }
    
    
}

-(void)setupdata{
    Pubmode *leixing=[[Pubmode alloc]init];
    leixing.name=@"车源类型";
    leixing.detail=@"请选择";
    leixing.index=-1;
    leixing.block=^{
        CarsrouceTypePickerController *picker=[CarsrouceTypePickerController picker];
        picker.currtpostion=self.leixing.index;
        
        picker.block=^(NSString *str,NSString *cs_id,NSInteger currtpostion){
            
            [self clearother];
            self.leixing.detail=str;
            self.leixing.index=currtpostion;
            self.leixing.csid=cs_id;
            
            NSIndexSet *set=[NSIndexSet indexSetWithIndex:0];
            
            [self.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationAutomatic];
        };
        
        [self.navigationController pushViewController:picker animated:YES];
    };
    
    leixing.isMust=YES;
    self.leixing=leixing;
    CarPickModel *chexing=[[CarPickModel alloc]init];
    chexing.name=@"车型";
    chexing.isMust=YES;
    chexing.detail=@"请选择";
    chexing.block=^{
        if ([self.leixing.detail isEqualToString:@"请选择"]) {
            MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
            hud.labelText=@"请先选择车源类型";
            hud.mode = MBProgressHUDModeText;
            hud.margin = 10.f;
            hud.removeFromSuperViewOnHide = YES;
            [hud hide:YES afterDelay:1];
        }else{
            FindCarTableViewController *fincar=[FindCarTableViewController findcar];
            fincar.type=self.leixing.csid;
            [self.navigationController pushViewController:fincar animated:YES];
        }
    };
    self.chexing=chexing;
    Pubmode *waiguan=[[Pubmode alloc]init];
    waiguan.name=@"外观颜色";
    waiguan.isMust=YES;
    waiguan.detail=@"请选择";
    self.waiguan=waiguan;
    waiguan.block=^{
        if ([self.chexing.detail isEqualToString:@"请选择"]) {
            MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
            hud.labelText=@"请先选择车型";
            hud.mode = MBProgressHUDModeText;
            hud.margin = 10.f;
            
            hud.removeFromSuperViewOnHide = YES;
            [hud hide:YES afterDelay:1];
        }else{
            ColorPickViewController *color=[ColorPickViewController colorpicker];
            color.delegate=self;
            
            color.ID=self.chexing.cardetail.ID;
            color.index=self.waiguan.index;
            color.colorstr=self.waiguan.detail;
            color.isOut=YES;
            color.view.tag=0;
            [self.navigationController pushViewController:color animated:YES];}
        
    };


    Pubmode *neishi=[[Pubmode alloc]init];
    neishi.name=@"内饰颜色";
    neishi.isMust=YES;
    neishi.detail=@"请选择";
    self.neishi=neishi;
    neishi.block=^{
        if ([self.chexing.detail isEqualToString:@"请选择"]) {
            MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
            hud.labelText=@"请先选择车型";
            hud.mode = MBProgressHUDModeText;
            hud.margin = 10.f;
            
            hud.removeFromSuperViewOnHide = YES;
            [hud hide:YES afterDelay:1];
        }else{
            ColorPickViewController *color=[ColorPickViewController colorpicker];
            color.delegate=self;
            
            color.ID=self.chexing.cardetail.ID;
            color.index=self.neishi.index;
            color.colorstr=self.neishi.detail;
            color.isOut=NO;
            color.view.tag=1;
            [self.navigationController pushViewController:color animated:YES];}
        
    };

    Pubmode *kuning=[[Pubmode alloc]init];
    kuning.name=@"库龄要求";
    
    kuning.titlearray=@[@"3个月",@"6个月",@"12个月",@"不限"];
    kuning.radioindex=-1;
    
    self.kuling=kuning;
    Pubmode *paifang=[[Pubmode alloc]init];
    paifang.name=@"排放要求";
    
    paifang.titlearray=@[@"国四",@"国五",@"不限"];
    paifang.radioindex=-1;
    self.paifang=paifang;
    Pubmode *shangpai=[[Pubmode alloc]init];
    shangpai.name=@"上牌地点";
    shangpai.isMust=YES;
    shangpai.detail=@"请选择";
    shangpai.block=^{
        CityPickerView *pickcer=[[CityPickerView alloc]initWithDelegate:self WithColoum:3];
        pickcer.tag=0;
        [pickcer showinView:self.navigationController.view];
    };
    self.shangpai=shangpai;
    Pubmode *jiaohuo=[[Pubmode alloc]init];
    jiaohuo.name=@"交货地点";
    jiaohuo.isMust=YES;
    jiaohuo.detail=@"请选择";
    jiaohuo.block=^{
        CityPickerView *pickcer=[[CityPickerView alloc]initWithDelegate:self WithColoum:3];
        pickcer.tag=1;
        [pickcer showinView:self.navigationController.view];
    };
    self.jiaohuo=jiaohuo;
    Pubmode *riqi=[[Pubmode alloc]init];
    riqi.name=@"交车日期";
    
    riqi.titlearray=@[@"3天",@"7天",@"15天",@"期货"];
    riqi.radioindex=-1;
    self.riqi=riqi;
    Pubmode *fangshi=[[Pubmode alloc]init];
    fangshi.name=@"交车方式";
    self.fangshi=fangshi;
    fangshi.titlearray=@[@"卖家发车",@"买家提车"];
    fangshi.radioindex=-1;
    
    Pubmode *yixiangjia=[[Pubmode alloc]init];
    yixiangjia.name=@"招标意向价";
    yixiangjia.isEidt=YES;
    yixiangjia.placehoder=@"请输入意向价";
    yixiangjia.isMust=YES;
    self.yixiang=yixiangjia;
    Pubmode *beizhu=[[Pubmode alloc]init];
    beizhu.name=@"备注";
    beizhu.detail=@"请输入";
    beizhu.block=^{
        JianjieViewController *jjvc=[JianjieViewController viewcontroller];
        jjvc.navtitle=@"备注";
        jjvc.text=[beizhu.detail isEqualToString:@"请输入"]?@"":beizhu.detail;
        jjvc.block=^(NSString *str){
            self.beizhu.detail=str;
            NSIndexPath *indexpath=[NSIndexPath indexPathForRow:11 inSection:0];
            [self.tableView reloadRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationAutomatic];
            
        };
        [self.navigationController pushViewController:jjvc animated:YES];
    };
    self.beizhu=beizhu;
   
    [self.setetionarray addObject:leixing];
    [self.setetionarray addObject:chexing];
    [self.setetionarray addObject:waiguan];
    [self.setetionarray addObject:neishi];
    
    [self.setetionarray addObject:kuning];
    [self.setetionarray addObject:paifang];
    [self.setetionarray addObject:shangpai];
    [self.setetionarray addObject:jiaohuo];
    [self.setetionarray addObject:riqi];
    [self.setetionarray addObject:fangshi];
    [self.setetionarray addObject:yixiangjia];
    [self.setetionarray addObject:beizhu];
    
    
    [self.array addObject:self.setetionarray];
    
    XQModel *xuzhimode=[[XQModel alloc]init];
    xuzhimode.img=@"qb_y_ico";
    xuzhimode.title=@"招投标须知";
    xuzhimode.color=UIColorWithRGB(251, 75, 55);
    xuzhimode.block=^{
        ZTBSMViewController *vc=[ZTBSMViewController Viewcontroller];
        [self.navigationController pushViewController:vc animated:YES];
    };
    [self.array addObject:@[xuzhimode]];
    
    NoramlCellMode *mode=[[NoramlCellMode alloc]init];
    mode.title=@"需付保证金";
    mode.detail=@"2000元";
    [self.array addObject:@[mode]];
}

-(void)setuppostbtn{
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, XHScreenwidth, 64)];
    UIButton *postbtn=[[UIButton alloc]initWithFrame:CGRectMake(16, 16, XHScreenwidth-32, 36)];
    [postbtn setBackgroundImage:[UIImage imageNamed:@"bottom_bg"] forState:UIControlStateNormal];
    [postbtn setTitle:@"预付保证金并发布" forState:UIControlStateNormal];
    [postbtn setImage:[UIImage imageNamed:@"qb_w_ico"] forState:UIControlStateNormal];
    [postbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    postbtn.titleLabel.font=[UIFont systemFontOfSize:14];
    postbtn.imageEdgeInsets=UIEdgeInsetsMake(0, -10, 0, 0);
    [postbtn addTarget:self action:@selector(postclick) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:postbtn];
    self.tableView.tableFooterView=view;
}
-(void)postclick{
    if ([self checkFrom]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"正在发布..";
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        
        
        NSMutableDictionary *params=[NSMutableDictionary dictionary];
        
        params[@"action"]=@"add_zhao";
        params[@"type_id"]=self.leixing.csid;
        params[@"b_id"]=self.chexing.brand.brand_id;
        params[@"car_name"]=self.chexing.cardetail.name;
        params[@"car_type"]=self.chexing.cardetail.ID;
        params[@"out_c"]=self.waiguan.detail;
        params[@"in_c"]=self.neishi.detail;
        switch (self.kuling.radioindex) {
            case 0:
                params[@"sta_ask"]=@"3";
                break;
            case 1:
                params[@"sta_ask"]=@"6";
                break;
            case 2:
                params[@"sta_ask"]=@"12";
                break;
            case 3:
                params[@"sta_ask"]=@"0";
                break;
            default:
                params[@"sta_ask"]=@"0";
                break;
        }
        switch (self.paifang.radioindex) {
            case 0:
                params[@"stand"]=@"4";
                break;
            case 1:
                params[@"stand"]=@"5";
                break;
            case 2:
                params[@"stand"]=@"0";
                break;
            default:
                params[@"stand"]=@"0";
                break;
        }
        params[@"go_b"]=self.shangpai.detail;
        params[@"stuf"]=self.jiaohuo.detail;
        switch (self.jiaohuo.radioindex) {
            case 0:
                params[@"stuf_time"]=@"3";
                break;
            case 1:
                params[@"stuf_time"]=@"7";
                break;
            case 2:
                params[@"stuf_time"]=@"15";
                break;
            case 3:
                params[@"stuf_time"]=@"0";
                break;
            default:
                params[@"stuf_time"]=@"0";
                break;
        }
        switch (self.fangshi.radioindex) {
            case 0:
                params[@"how_stuf"]=@"1";
                break;
            case 1:
                params[@"stuf_time"]=@"0";
                break;
            default:
                params[@"stuf_time"]=@"0";
                break;
        }
        params[@"zhao_price"]=self.yixiang.detail;
        NSInteger power=[self.user.power integerValue];
        if (power==1) {
            params[@"user_id"]=self.user.user_id;
        }else if (power==5){
            params[@"com_id"]=self.user.com_id;
         
        }else if (power==8){
            params[@"com_id"]=self.user.com_id;
            params[@"parent_id"]=self.user.parent_id;
        }
        if (![self.beizhu.detail isEqualToString:@"请输入"]) {
             params[@"back_up"]=self.beizhu.detail;
        }
       [PostUitls Post:zhaobiaourl parameters:params success:^(id response) {
           hud.mode=MBProgressHUDModeText;
           NSDictionary *dict=response;
           
           NSNumber *state=dict[@"state"];
           if ([state integerValue]==400) {
               
           }
           hud.labelText=dict[@"msg"];
           [hud hide:YES afterDelay:0.5];
       } failure:^(NSError *error) {
           hud.mode=MBProgressHUDModeText;
           hud.labelText=@"网络错误";
           [hud hide:YES afterDelay:0.5];
       }];
    }
}
-(BOOL)checkFrom{
    if ([self.leixing.detail isEqualToString:@"请选择"]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请选择车源类型";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }
    if ([self.chexing.detail isEqualToString:@"请选择"]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请选择车型";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }
    if ([self.waiguan.detail isEqualToString:@"请选择"]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请选择外观颜色";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }
    if ([self.neishi.detail isEqualToString:@"请选择"]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请选择内饰颜色";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }
    if ([self.shangpai.detail isEqualToString:@"请选择"]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请选择上牌地点";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }
    if ([self.jiaohuo.detail isEqualToString:@"请选择"]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请选择交货地点";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }
    if (self.yixiang.detail==nil||[self.yixiang.detail isEqualToString:@""]) {
        MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
        hud.labelText=@"请输入招标意向价";
        hud.mode = MBProgressHUDModeText;
        hud.margin = 10.f;
        hud.removeFromSuperViewOnHide = YES;
        [hud hide:YES afterDelay:1];
        return NO;
    }

    return YES;

}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.1;
}

-(NSMutableArray *)array{
    if (_array==nil) {
        _array=[NSMutableArray array];
    }
    return _array;
}
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    [self.tableView becomeFirstResponder];
}

-(NSMutableArray *)setetionarray{
    if (_setetionarray==nil) {
        _setetionarray=[NSMutableArray array];
    }
    return _setetionarray;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source




- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return self.array.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete method implementation.
    // Return the number of rows in the section.
    NSArray *array=self.array[section];
    
    return array.count;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
     NSArray *array=self.array[indexPath.section];
    id mode=array[indexPath.row];
    if ([mode isKindOfClass:[Pubmode class]]) {
        Pubmode *pmode=mode;
        if (pmode.block) {
            pmode.block();
        }
    }else if([mode isKindOfClass:[XQModel class]]){
        XQModel *xmode=mode;
        if (xmode.block) {
            xmode.block();
        }
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSArray *array=self.array[indexPath.section];
    id tmode=array[indexPath.row];
    if ([tmode isKindOfClass:[Pubmode class]]) {
        Pubmode *mode=tmode;
    if (mode.titlearray) {
        RadioTableViewCell *cell=[RadioTableViewCell cellWithTablView:tableView];
        cell.mode=mode;
        return cell;
    }else if (mode.isEidt){
        EidtTableViewCell *cell=[EidtTableViewCell cellWithTable:tableView];
        cell.mode=mode;
        return cell;
    }else if ([mode isKindOfClass:[CarPickModel class]]&&[self.leixing.detail isEqualToString:@"中规"]){
        CarDetailTableViewCell *cell=[CarDetailTableViewCell cellwithTablview:tableView];
        if (self.chexing.cardetail) {
            cell.carname.text=self.chexing.cardetail.name;
            cell.price.textColor=textnormalGary;
            cell.carname.textColor=textnormalGary;
            cell.price.text=[NSString stringWithFormat:@"%@",self.chexing.cardetail.price];
        }else{
            cell.carname.text=nil;
            cell.price.text=@"请选择";
            cell.price.textColor=placehodlerColor;
            cell.carname.textColor=placehodlerColor;
        }
        return cell;
    }
    else {
        PublishTopTableViewCell *cell=[PublishTopTableViewCell cellWithTableView:tableView];
        cell.titlelable.text=mode.name;
        cell.startlable.hidden=!mode.isMust;
        cell.detail.hidden=mode.isNormal;
        cell.detail.text=mode.detail;
        if (mode.isNormal) {
            cell.accessoryType=UITableViewCellAccessoryNone;
        }else {
            cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        }
        if ([mode.detail isEqualToString:@"请选择"]||[mode.detail isEqualToString:@"请输入"]) {
            cell.detail.textColor=placehodlerColor;
        }else{
            cell.detail.textColor=textnormalGary;
        }

        return cell;
        
    }
    }else if ([tmode isKindOfClass:[XQModel class]]){
        XQModel *xq=tmode;
        BaojiaTitleTableViewCell *cell=[BaojiaTitleTableViewCell cellWithTableView:tableView];
        cell.icon.image=[UIImage imageNamed:xq.img];
        cell.title.text=xq.title;
        cell.title.textColor=xq.color;
        return cell;

    }else {
        NoramlCellMode *mode=tmode;
        NoramlTableViewCell *cell=[NoramlTableViewCell cellWithTableView:tableView];
        cell.textLabel.text=mode.title;
        cell.detailTextLabel.text=mode.detail;
        cell.detailTextLabel.textColor=tintblue;
        return cell;
    }
}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
